package com.testerhome.cases.API;

import com.testerhome.pages.SelfLogger;
import org.testng.annotations.Test;

import static io.restassured.RestAssured.given;
import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author sunliancheng
 * @date 2024/2/25
 */
public class 用例3_接口验证 {
    @Test
    public void test(){
        String url = "https://open.dangdang.com/index.php?c=apiList&f=show&api_id=231";
        String response = given()
                .relaxedHTTPSValidation()
                .when()
                .get(url)
                .then()
                .extract()
                .body()
                .asString();
        SelfLogger.info("返回值为:" + response);
        assertThat(response).startsWith("{\"data\":[{\"id\"");
    }
}
